function request(url, params = {}, type = "post", dataType = "json") {
    return new Promise(function (resolve, reject) {
        $.ajax({
            type: type,
            url: url,
            data: {
                ...params
            },
            async: true,
            dataType: dataType,
            success: function (result) {
                resolve(result);
            }
        })
    })
}


const searchOrderLimit = params => request("../php/searchOrderLimit.php", params, type = "get", dataType = "json");

const SearchAllgoods = params => request("../php/SearchAllgoods.php", params, type = "get", dataType = "json");

const searchGoodsById = params => request("../php/searchGoodsById.php", params, type = "get", dataType = "json");

const searchRecomGoods = params => request("../php/searchRecomGoods.php", params, type = "get", dataType = "json");

const searchRankGoods = params => request("../php/searchRankGoods.php", params, type = "get", dataType = "json");

const addShoppingCar = params => request("../php/addShoppingCar.php", params, type = "post", dataType = "json");

const searchShoppingByUser = params => request("../php/searchShoppingByUser.php", params, type = "post", dataType = "json");

const deleteShoppingCarById = params => request("../php/deleteShoppingCarById.php", params, type = "get", dataType = "json");

const updateShoppingCarById = params => request("../php/updateShoppingCarById.php", params, type = "get", dataType = "json");

const sort = params => request("../php/sort.php", params, type = "get", dataType = "json");

